var t = getApp();

Page({
    data: {
        contentlist: [],
        isLoadMore: !0,
        page: 1,
        total_page: 0
    },
    onLoad: function(t) {
        this.getContentlist();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {},
    gobrandgoods: function(t) {
        var a = t.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageB/member/category/brandgoods/brandgoods?id=" + a
        });
    },
    getContentlist: function() {
        var a = this, e = t.getNetAddresss("goods.brand.get-brand");
        t._getNetWork({
            url: e,
            data: {
                page: 1,
                is_recommend: 1
            },
            success: function(t) {
                var e = t.data;
                1 == e.result && a.setData({
                    total_page: e.data.last_page,
                    contentlist: e.data.data
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    _getMoreData: function() {
        var a = this;
        if (a.setData({
            isLoadMore: !1
        }), !(this.data.page >= this.data.total_page)) {
            a.setData({
                page: a.data.page + 1
            });
            var e = t.getNetAddresss("goods.brand.get-brand");
            e += "&page=" + a.data.page, t._getNetWork({
                url: e,
                success: function(t) {
                    var e = t.data;
                    if (a.setData({
                        isLoadMore: !0
                    }), 1 == e.result) {
                        var o = e.data.data;
                        a.setData({
                            contentlist: a.data.contentlist.concat(o)
                        });
                    } else a.setData({
                        page: a.data.page - 1,
                        isLoadMore: !1
                    });
                },
                fail: function(t) {
                    console.log(t.msg);
                }
            });
        }
    }
});